<?php
class Soyia extends Object
{
	static function instance($library_name)
	{
		$file_not_exist = array();
		$array_library = explode('.', $library_name);
		$library_name = str_replace('.', '', $library_name);
		
		if(file_exists(PATH_SYSTEM.'core'.DIRECTORY_SEPARATOR.$library_name.EXT)){
			require_once(PATH_SYSTEM.'core'.DIRECTORY_SEPARATOR.library_name.EXT);
			$script = '$library =  new '.$library_name."();";
			$script .= '$library->path = "'.str_replace("\\", "\\\\", $library_name.DIRECTORY_SEPARATOR).'";';
			die($script);
			eval($script);
			$library->initialize();
			//$library->objects = array();
			return $library;
		}
		$file_not_exist[] = PATH_LIBRARY.'core'.DIRECTORY_SEPARATOR.$library_name.EXT;
		
		echo("The following library file(s) cannot be found on server:<br />");
		foreach( $file_not_exist as $key=>$val){
			echo "<b>".$val."</b> not exists!<br />";
		}
		die();
	}
}
?>